package com.yc.testPro;

public class TestString {
	
	public void m1() {
		String s = "saldjw23287jfdsjfl7dsfdfuds3iof";
		String res = s.replaceAll("[^0-9]", "");
		System.out.println("res=" + res);
	}
	
	//替换掉“非数字”
	public void m2() {
		String s = "2019-04-15 03:12:09";
		String res = s.replaceAll("[^0-9]", "");
		System.out.println("res=" + res);
	}
	
	//用“非数字”分割字符串
	public void m3() {
		String s = "2019-04-15 03:12:09";
		String s2 = "";
		String[] result = s.split("\\D");
		for (String str : result) {
			s2 += str;
		}
		System.out.println(s2);
	}
	
	//约瑟环
	public void m4() {
		Boolean[] usaJapa = new Boolean[30];
		for (int i = 0; i < usaJapa.length; i++) {
			usaJapa[i] = true;
		}
		
		int leftCount = usaJapa.length;
		int countNum = 0;
		int index = 0;
		while(leftCount > 1) {
			countNum++;
			if (countNum == 9) {
				countNum = 0;
				usaJapa[index] = false;
				leftCount --;
			}
			index ++;
			if (index == usaJapa.length)
				index = 0;
		}
		
		for (int i = 0; i < usaJapa.length; i++) {
			System.out.print(i + "=" + usaJapa[i] + " ");
		}
	}

	public void m5() {
		String str = "187******22";
		if (str.indexOf("******") != -1) {
			System.out.print("-----------");
		}
	}

	public static void main(String[] args) {
		TestString ts = new TestString();
//		ts.m4();
		ts.m5();
	}
	

}
